import React from 'react'
import { Button, List, } from 'antd-mobile'
import { useNavigate } from 'react-router-dom'

function Index() {
  // 跳转
  const navigate = useNavigate()
  // 数据
  const person = [
    {
      id: 1,
      name: '张小三',
      code: '132311200001012113',
    },
    {
      id: 2,
      name: '热巴',
      code: '145420588945510545',
    },
    {
      id: 3,
      name: '赵铁锤',
      code: '458895555246226555',
    },
  ]
  // 去添加乘车人
  const handleToPerson = () => {
    navigate('/person')
  }
  return (
    <div>
      <List header='乘车人'>
        <Button size='small' color='primary' onClick={() => handleToPerson()}>
          添加乘车人
        </Button>
        {
          person.map((item, index) => {
            return <div>
              <List.Item key={index}>
                <p>{item.name}</p>
                <p>{item.code}</p>
              </List.Item>
            </div>
          })
        }
      </List>
    </div>
  )
}

export default Index
